package demo.java.b_cases;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;


public class Demo03_when extends SimpleTagSupport{
	
	private boolean test;
	
	public void setTest(boolean test){
		this.test=test;
	}
	
	@Override
	public void doTag() throws JspException, IOException {
		//when标签
		//将test的值保存到父标签里给otherwise使用
		if(test){
			this.getJspBody().invoke(null);
		}
		Demo02_choose choose=(Demo02_choose)this.getParent();
		choose.setFlag(test);
	}
}
